﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Hinshelwood.TeamFoundation.EventHandlerConfig">
    
    <DataTemplate DataType="{x:Type local:SettingsWindowViewModel}">
            <DockPanel Background="DarkGray">
            <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Orientation="Horizontal">
                <Button Content="Save" />
                <Button Content="Cancel" />
            </StackPanel>
            <DockPanel>
                <ListBox DockPanel.Dock="Left" 
                         Background="DarkGray"
                         ItemsSource="{Binding SettingsGroups}" 
                         SelectedItem="{Binding SelectedSettingsGroup, Mode=TwoWay}" />
                <ItemsControl ItemTemplate="{DynamicResource WrapperSettingsVewModelTemplate}" ItemsSource="{Binding SelectedSettingsGroup.Settings}" />
            </DockPanel>
            </DockPanel>
    </DataTemplate>

    <DataTemplate DataType="{x:Type local:SettingsGroupViewModel}">
                <Label Content="{Binding Header.Header}" />              
    </DataTemplate>
    
    <DataTemplate x:Key="WrapperSettingsVewModelTemplate" DataType="{x:Type local:SettingsViewModel}">
        <Border CornerRadius="5" Margin="5" Background="Gray"  BorderBrush="Gray" BorderThickness="2">
            <DockPanel>
                <ContentControl DockPanel.Dock="Top" Content="{Binding Header}" />
                <Border CornerRadius="5" Background="DarkGray" Margin="5"  BorderBrush="Gray" BorderThickness="2">
                    <ContentControl Content="{Binding}" />
                </Border>
            </DockPanel>
        </Border>
    </DataTemplate>

   <DataTemplate DataType="{x:Type local:HeaderViewModel}">
                    <Label DockPanel.Dock="Top" Content="{Binding Header}" />
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type local:CollectionHeaderViewModel}">
        <DockPanel>
            <Button DockPanel.Dock="Right" Content="Add" />
            <Label DockPanel.Dock="Left" Content="{Binding Header}" />
        </DockPanel>
                
    </DataTemplate>

    <DataTemplate DataType="{x:Type local:SettingsViewModel}">
                    <Label Content="Options go here" />
    </DataTemplate>

    <DataTemplate DataType="{x:Type local:TeamServerListViewModel}">
        <DockPanel>
            <ItemsControl Background="DarkGray" ItemsSource="{Binding TeamServers}" />
        </DockPanel>
    </DataTemplate>

    <DataTemplate DataType="{x:Type local:TeamServerViewModel}">
        <Border CornerRadius="10" Margin="2" Padding="5" Background="DarkGray"  BorderBrush="Black" BorderThickness="2">
            <StackPanel>
                <Label Content="{Binding Header}" />
                <Border Margin="5">
                    <DockPanel>
                        <StackPanel DockPanel.Dock="Right">
                            <Button Content="Edit" />
                            <Button Content="Delete" />
                        </StackPanel>
                        <StackPanel>
                            <StackPanel>
                                <Label Content="{Binding Url}" ContentStringFormat="Server: {0}" />
                            </StackPanel>
                            <Label Content="Options go here" />
                        </StackPanel>
                    </DockPanel>
                                        
                </Border>
            </StackPanel>
            
        </Border>
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type local:EventListViewModel}">
        <DockPanel>
            <ItemsControl ItemTemplate="{DynamicResource WrapperSettingsVewModelTemplate}" 
                          Background="DarkGray" 
                          ItemsSource="{Binding Events}" />
        </DockPanel>
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type local:EventViewModel}">
        <DockPanel>
            <ItemsControl ItemTemplate="{DynamicResource WrapperSettingsVewModelTemplate}" 
                          Background="DarkGray" 
                          ItemsSource="{Binding Handlers}" />
        </DockPanel>
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type local:HandlerViewModel}">
        <DockPanel>
            <Label Content="Options go here" />
        </DockPanel>
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type local:UrlReplacementListViewModel}">
        <DockPanel>
            <ItemsControl Background="DarkGray" ItemsSource="{Binding UrlReplacements}" />
        </DockPanel>
    </DataTemplate>

</ResourceDictionary>
